﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Root="clr-namespace:Elysium.Theme">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Elysium.Theme;component/Themes/SharedResources.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type TabItem}">

        <Setter Property="Background" Value="{StaticResource Transparent}"/>
        <Setter Property="BorderBrush" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}}, Path=BorderBrush}"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="{StaticResource ForegroundLowlight}"/>
        <Setter Property="FontFamily" Value="{x:Static Root:Parameters.FontFamily}"/>
        <Setter Property="FontSize" Value="{x:Static Root:Parameters.HeaderFontSize}"/>
        <Setter Property="FontWeight" Value="Normal"/>
        
        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualStyle}"/>

        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Padding" Value="{x:Static Root:Parameters.BoldPadding}"/>

        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="SnapsToDevicePixels" Value="True"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"
                                                  SharedSizeGroup="TabItemColumnSizeGroup"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"
                                               SharedSizeGroup="TabItemRowSizeGroup"/>
                            </Grid.RowDefinitions>
                            <Border Background="{StaticResource Transparent}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabControl}}, Path=(Root:Parameters.TabControlIndicatorThickness)}"
                                    TextBlock.Foreground="{TemplateBinding Foreground}"
                                    TextBlock.FontFamily="{TemplateBinding FontFamily}"
                                    TextBlock.FontSize="{TemplateBinding FontSize}"
                                    TextBlock.FontWeight="{TemplateBinding FontWeight}">
                                <ContentPresenter x:Name="ContentHost"
                                                  ContentSource="Header"
                                                  Margin="{TemplateBinding Padding}"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                  RecognizesAccessKey="True"/>
                            </Border>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="TabStripPlacement" Value="Left">
                            <Setter TargetName="ContentHost" Property="LayoutTransform">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="TabStripPlacement" Value="Right">
                            <Setter TargetName="ContentHost" Property="LayoutTransform">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        
        <Style.Triggers>            
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource ForegroundLowlight}"/>
                <Setter Property="Foreground" Value="{StaticResource Foreground}"/>
            </Trigger>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="BorderBrush" Value="{StaticResource Accent}"/>
                <Setter Property="Foreground" Value="{StaticResource Foreground}"/>
                <Setter Property="FontWeight" Value="SemiBold"/>
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="BorderBrush" Value="{StaticResource Disabled}"/>
                <Setter Property="Foreground" Value="{StaticResource Disabled}"/>
            </Trigger>            
        </Style.Triggers>
        
    </Style>

</ResourceDictionary>